<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Login/Register Page</title>
    <link rel="stylesheet" href="../../plugins/element-ui/lib/theme-chalk/index.css">
    <!-- 引入样式 -->
    <link rel="stylesheet" href="../../plugins/elementui/index.css">
    <link rel="stylesheet" href="../../plugins/font-awesome/css/font-awesome.min.css">
    <link rel="stylesheet" href="../../css/style.css">
</head>
<body>
<div id="app">
    <el-tabs v-model="activeTab">
        <el-tab-pane label="登录" name="login">
            <el-form ref="loginForm" :model="loginForm" label-width="80px">
                <el-form-item label="用户名" prop="username">
                    <el-input style="width: 300px" v-model="loginForm.username"></el-input>
                </el-form-item>
                <el-form-item label="密码" prop="password" >
                    <el-input style="width: 300px" v-model="loginForm.password" type="password"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="handleLogin">登录</el-button>
                </el-form-item>
            </el-form>
        </el-tab-pane>
    </el-tabs>
</div>
</body>
<script src="../../js/vue.js"></script>
<script src="../../plugins/elementui/index.js"></script>
<script type="text/javascript" src="../../js/jquery.min.js"></script>
<script src="../../js/axios-0.18.0.js"></script>
<script src="../../js/vue.js"></script>
<script src="../../plugins/element-ui/lib/index.js"></script>
<script>
    new Vue({
        el: '#app',
        data: {
            activeTab: 'login',
            loginForm: {
                username: '',
                password: ''
            },
        },
        methods: {
            handleLogin(){
                axios.post("/user/login",this.loginForm).then((response) => {
                    if(response.data.code==200){
                        window.location.href="/travelpage/pages/user/test.html"
                        this.$message.success(response.data.message);
                    }else{
                        this.$message.error(response.data.message);
                    }
                })
            }
        }
    });
</script>
</html>
